/*
 * Decode class shif
 */
package memsim.instructions;
import memsim.SymbolTable;


/**
 *
 * @author kimchouSok
 * Decode class is logical shift right 5 bit
 */
public class Decode {

    public static int ShiftOpcode(int op){
        int temp;
        temp = op >>> 27;
        return temp;
    }

    public static int secondFiveBits(int op){ //Dst reg
        int temp;

        temp = op >>> 22;
        temp = temp & 31;

        return temp;



    }

    public static int thirdFiveBits(int op){//src reg 1
        int temp;

        temp = op >>> 17;

        temp = temp & 31;
        
        return temp;



    }
    public static int fourthFiveBits(int op){  //src reg 2 or other 5bit value
        int temp;

        temp = op >>> 12;
       
        temp = temp & 31;
        
        return temp;
    }

     public static DecodedObject decoded(int op){
        // SymbolTable sT = new SymbolTable();

         int opCode = ShiftOpcode(op);
         int dstReg = secondFiveBits(op);
         int src1 = thirdFiveBits(op);
         int src2 = fourthFiveBits(op);
         DecodedObject temp = new DecodedObject(opCode, dstReg, src1, src2);

         return temp;

     }



    }

   



